package com.db.file;


import cn.hutool.core.io.file.FileReader;
import cn.hutool.core.io.file.FileWriter;
import cn.hutool.core.util.StrUtil;

import java.util.List;

/**
 * @author xin.ding
 * @date 2019/10/31 15:47
 */
public class FileUtils {

    private static String filePath = "C:\\Users\\xin.ding\\Desktop\\dfzq\\dsg数据包.txt";
    private static  String newPath = "C:\\Users\\xin.ding\\Desktop\\dfzq\\dsg.txt";
    public static void main(String[] args) {
//        System.out.println(StrUtil.subAfter("abc", "a", true));
        subAfterFile("数据");

    }



    public static void subAfterFile(String after) {

        FileReader fileReader = new FileReader(filePath);
        List<String> data = fileReader.readLines();
        for (String str : data) {
            String result = StrUtil.subAfter(str, after, true);
            FileWriter fileWriter = new FileWriter(newPath);
            fileWriter.append(result+"\r");
        }
    }
}
